package main

import (
	"gitee.com/microwww/jvm-go/jvm/classfile"
	"gitee.com/microwww/jvm-go/jvm/tool"
	"log"
	"path/filepath"
)

func main() {
	ok := tool.ParseArgs()
	args := tool.GetArgs()
	if !ok {
		return
	}

	log.Default().Printf("%#v \n", args)

	// D:\Program\Java\jdk1.8.0_191\jre\lib
	path := tool.Path{
		BootClasspath:   filepath.Join(args.Xjre, "lib"),
		ExtendClasspath: filepath.Join(args.Xjre, "lib", "ext"),
		UserClasspath:   args.Args,
	}
	bts, _, e := classfile.LookupClass(&path, args.Class)
	if e != nil {
		log.Default().Println("Error :", e)
		return
	}
	log.Printf("class: %v, bytes: \n%#v \n", args.Class, bts)
}
